import e
import botpy
from botpy.types.message import Message


class ExamplePlugin:
    trigger_keywords = "test"

    def priority(self):  # 优先级
        return 2

    def should_trigger(self, message: Message, event):
        # 判断是否触发插件逻辑的条件
        result = False  # 初始化结果变量
        if hasattr(message, 'content'):
            if not message.content is None:
                result = message.content == self.trigger_keywords and (
                        event == 0 or event == 1)
            else:
                result = False and (
                        event == 0 or event == 1)
        return result

    async def execute(self, message: Message, api, event):
        str = "test for example"
        url = "https://gchat.qpic.cn/qmeetpic/611234663990953304/553334500-2777245694-FF52EAD1AA3D251001872851D9CF3C03/0"
        msg = [str, {"image": url}]
        await e.reply(api, message, msg, True)
        return False
